package org.longteng.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.longteng.dao.model.AuthUser;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 *用户帐号表dao
 * @author Hymn
 * @date 2022/12/15
 */
@Mapper
@CacheNamespace  //     //使用二级缓存机制
public interface AuthUserMapper extends BaseMapper<AuthUser> {

    /**
     * 返回有效用户帐号
     * @param userAccount
     * @return
     */
    @Select("select * from auth_user where actived=1 AND user_account = #{userAccount} LIMIT 1")
    public AuthUser getActiveUser(String userAccount);

    /**
     * 用户帐号密码验证
     * @param userAccount
     * @param password
     * @return
     */
    @Select("select * from auth_user where actived=1 AND user_account = #{userAccount} AND user_password = #{password} LIMIT 1")
    public AuthUser verifyUserAccount(String userAccount, String password);
}